

var pageContext = new PageContextDatatable(settings||{});
pageContext.setting.canShowFire = false;
pageContext.formInit = function(layero){
	var val = layero.find("select[name='categoryCode']").find("option:selected").text();
	layero.find("input[name='categoryName']").val(val);
	layero.find("select[name='categoryCode']").on("change",function(){
		var me = this;
		var val = $(this).find("option:selected").text();
		layero.find("input[name='categoryName']").val(val)
	});
}
pageContext.renderAddPageOther = function(layero,data,para,option){
};
pageContext.renderUpdatePageOther = function(layero,data,para,option){
	
    
	layero.find("select[name='categoryCode']").attr("oldval",data.categoryCode).find("option[value='"+data.categoryCode+"']").attr("selected",true);
    tvc.changeDefaultValue(layero.find("select[name='categoryCode']").get(0));
	
}

pageContext.getOtherOperBtn = function(id,label,record){
	var html = [];	
	if(pageContext.setting.canShowFire){
		html.push('<li>');
		html.push('<a href="javacript:void(0)" label="'+label+'" url="'+window.global.getFinalUrl(window.global.ctx+'/frm/form/item/index?formId='+record.id)+'"  val="'+id+'" class="tooltip-success propBtn" data-rel="tooltip" title="表单项信息">');
		html.push('<span class="green">');
		html.push('<i class="ace-icon fa fa-flask bigger-120"></i>');
		html.push('</span>');
		html.push('</a>');
		html.push('</li>');
	}
	return html.join("");
}
pageContext.getOtherPingPuOperBtn = function(id,label,record){
	var html = [];
	if(pageContext.setting.canShowFire){
		html.push('<button class="btn btn-xs btn-info propBtn" url="'+window.global.getFinalUrl(window.global.ctx+'/frm/form/item/index?formId='+record.id)+'"  label="'+label+'" val="'+id+'" title="表单项信息">');
		html.push('<i class="ace-icon fa fa-flask bigger-120"></i>');
		html.push('</button>');
	}
	return html.join("");
}
pageContext.renderAfterEventOther = function(){
	$('#'+pageContext.setting.tableId+' >tbody > tr > td').delegate(".propBtn","click",function(e){
		 var val = $(this).attr("val");
		 var label = $(this).attr("label");
		 var url = ($(this).attr("url"));
		 $("#newPage").closest("a").attr("href",url);
		 $("#newPage").click();
	     return false;
	});
}
pageContext.toAdd = function(option){
	var action = window.global.getFinalUrl(pageContext.setting.toAddUrl);
	load(action,"page-content",true,"新增"+pageContext.modelName,function(){
		
	});
}
pageContext.toDetail = function(id,data){
	var action = window.global.getFinalUrl(pageContext.setting.toDetailUrl);
	action = window.global.addPara(action,"id",id,true)
	load(action,"page-content",true,pageContext.modelName+"详情",function(){
		
	});
}
pageContext.toUpdate = function(id,data){
	var action = window.global.getFinalUrl(pageContext.setting.toUpdateUrl);
	action = window.global.addPara(action,"id",id,true)
	load(action,"page-content",true,"修改"+pageContext.modelName,function(){
		
	});
}
jQuery(function($) {
   pageContext.init();

	 $(document).find("input").each(function(){
		 $(this).attr("autocomplete","off");
	 });
}); 
